/**
 * Schema definitions.
 */
const mongoose = require('mongoose');

mongoose.model('OAuthTokens', new Schema({
    accessToken: {type: String},
    accessTokenExpiresOn: {type: Date},
    clientId: {type: String},
    refreshToken: {type: String},
    refreshTokenExpiresOn: {type: Date},
    userId: {type: String}
}));

mongoose.model('OAuthClients', new Schema({
    clientId: {type: String},
    clientSecret: {type: String},
    redirectUris: {type: Array}
}));

mongoose.model('OAuthUsers', new Schema({
    email: {type: String, default: ''},
    firstname: {type: String},
    lastname: {type: String},
    password: {type: String},
    username: {type: String}
}));

const OAuthTokensModel = mongoose.model('OAuthTokens');
const OAuthClientsModel = mongoose.model('OAuthClients');
const OAuthUsersModel = mongoose.model('OAuthUsers');

module.exports = {
    OAuthClientsModel, OAuthTokensModel, OAuthUsersModel
};